ops: smoother update and deploy workflows#37
Merged
Conversation
- baudbot update now pulls, deploys, and restarts in one command (was: pull + deploy only, user had to restart manually) - deploy.sh auto-detects admin user from repo ownership when SUDO_USER isn't set, so 'sudo baudbot deploy' just works without needing BAUDBOT_CONFIG_USER env var
Greptile SummaryThis PR simplifies the baudbot update workflow from three manual commands into a single
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
actor Admin
participant baudbot as baudbot (CLI)
participant git as git
participant deploy as deploy.sh
participant systemd as systemd
Admin->>baudbot: sudo baudbot update
baudbot->>baudbot: require_root()
baudbot->>git: git pull origin main
git-->>baudbot: latest code
baudbot->>deploy: deploy.sh [args]
Note over deploy: detect DEPLOY_USER:<br/>1. BAUDBOT_CONFIG_USER env<br/>2. SUDO_USER (if not root)<br/>3. stat -c '%U' repo owner<br/>4. whoami
deploy-->>baudbot: exit 0
baudbot->>systemd: systemctl is-active baudbot
alt service is running
baudbot->>systemd: systemctl restart baudbot
baudbot->>baudbot: sleep 2
baudbot->>systemd: systemctl is-active baudbot
alt still active
baudbot-->>Admin: ✅ Updated and running
else crashed
baudbot-->>Admin: ⚠️ Deployed but agent didn't restart
end
else service not running
baudbot-->>Admin: ✅ Updated. Start with: sudo baudbot start
end
Last reviewed commit: 37ef17d |
- Remove redundant 2>&1 after &>/dev/null (4 instances in baudbot)
- Consistent ${SUDO_USER:-} quoting in deploy.sh
- Bump restart wait to 3s with comment explaining why
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Updating baudbot required three separate commands:
Fix
baudbot updatedoes everythingPulls latest, deploys, and restarts if running. One command.
baudbot deployauto-detects admin userNo more
BAUDBOT_CONFIG_USER=bentlegen. Deploy now detects the admin from the repo's file ownership (stat -c '%U') whenSUDO_USERisn't available. Sosudo baudbot deployjust works.